package com.lihua.newideas.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lihua.newideas.mapper.UploadMapper;
import com.lihua.newideas.mapper.UploadUserMapper;
import com.lihua.newideas.pojo.UploadSystem;
import com.lihua.newideas.pojo.UploadUser;
import com.lihua.newideas.service.UploadUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UploadUserServiceImpl implements UploadUserService {
    @Autowired
    private UploadUserMapper uploadUserMapper;

    @Override
    public void save(UploadUser file) throws Exception {
        uploadUserMapper.insert(file);
    }

    @Override
    public PageInfo<UploadUser> getFileAll(String userName,int page, int limit) {
        String orderBy = "id desc"; //排序
        PageHelper.startPage(page, limit,orderBy);
        List<UploadUser> lists = uploadUserMapper.getAllFile(userName);
//        System.out.println("业务层：");
//        System.out.println(lists.get(0).toString());
//        PageInfo<UploadSystem> uploadSystemPageInfo = new PageInfo<>(lists);  等于 new PageInfo<>(lists)
        return new PageInfo<>(lists);
    }
}
